package com.hdyg.sixg.mvp.presenter;

import com.hdyg.sixg.entry.MineBean;
import com.hdyg.sixg.httpUtil.HttpCallback;
import com.hdyg.sixg.mvp.Contrant.CUpdatePwd;
import com.hdyg.sixg.mvp.base.BasePresenter;
import com.hdyg.sixg.util.ToastUtil;
import java.util.Map;

/**
 * @author CZB
 * @describe 修改密码
 * @time 2019/4/15 9:54
 */
public class PUpdatePwd extends BasePresenter implements CUpdatePwd.IPUpdatePwd {

    private CUpdatePwd.IVUpdatePwd mView;

    public PUpdatePwd(CUpdatePwd.IVUpdatePwd mView) {
        this.mView = mView;
    }

    @Override
    public void pGetInit(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback<MineBean>(false) {
            @Override
            public void onSuccess(MineBean dataBean) {
                mView.vGetInitSuccess(dataBean);
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetCode(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object dataBean) {
                mView.vGetCodeSuccess(dataBean.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetSureUpdate(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object dataBean) {
                mView.vGetSureUpdateSuccess(dataBean.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }
}
